package com.changgou.item.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: wzw
 * @Date: 2020/12/19 0:27
 * @version: 1.8
 */
@Configuration
@ControllerAdvice
public class EnableMvcConfig implements WebMvcConfigurer {

    /**
     * @author wzw
     * 对请求资源放行
     * @Date 0:30 2020/12/19
     * @param registry
     * @return void
    **/
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //对资源放行(请求的路径).(静态页面所在的目录路径)
        registry.addResourceHandler("/items/**")
                .addResourceLocations("classpath:/templates/items/");
    }
}
